package com.haitai.gas.integration.poi.policy;

import com.haitai.gas.integration.poi.vo.IndexVo;
import org.apache.poi.xwpf.usermodel.*;

/**
 * 首页
 */
public abstract class AbsIndexRenderPolicy extends BaseRenderPolicy<IndexVo> {

    @Override
    public int getPage() {
        return PAGE_INDEX;
    }

    protected void addNumber(XWPFDocument xwpfDocument, int index, String content) {
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.RIGHT);
        XWPFRun run2 = paragraph.createRun();
        run2.setFontSize(14);
        run2.setFontFamily("宋体");
        run2.setText(content);
        run2.setBold(true);
    }

    protected void addProInfo(XWPFDocument xwpfDocument, String title, String content) {
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setIndentationLeft(700);

        XWPFRun run = paragraph.createRun();
        run.setFontSize(14);
        run.setFontFamily("宋体");
        run.setText(title);
        run.setBold(true);

        XWPFRun run2 = paragraph.createRun();
        run2.setFontSize(14);
        run2.setFontFamily("宋体");
        run2.setText(content);
        run2.setUnderline(UnderlinePatterns.SINGLE);
        run2.setBold(true);
    }

    protected void genTitle(XWPFDocument xwpfDocument, String mainTitle) {
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.CENTER);
        XWPFRun run = paragraph.createRun();
        run.setFontSize(40);
        run.setBold(true);
        run.setFontFamily("黑体");
        run.setCharacterSpacing(150);
        run.setText(mainTitle);
    }

    protected void addMark(XWPFDocument xwpfDocument, String content) {
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setIndentationLeft(500);
        XWPFRun run2 = paragraph.createRun();
        run2.setFontSize(12);
        run2.setFontFamily("楷体");
        run2.setText(content);
        run2.setBold(true);
        run2.setColor("808080");
    }

    protected void addMiniTitle(XWPFDocument xwpfDocument, String content){
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.RIGHT);
        XWPFRun run2 = paragraph.createRun();
        run2.setFontSize(14);
        run2.setFontFamily("宋体");
        run2.setText(content);
        run2.setBold(true);
    }

    protected void addTitle(XWPFDocument xwpfDocument, String mainTitle) {
        XWPFParagraph paragraph = xwpfDocument.createParagraph();
        paragraph.setAlignment(ParagraphAlignment.CENTER);
        XWPFRun run = paragraph.createRun();
        run.setFontSize(22);
        run.setBold(true);
        run.setFontFamily("宋体");
        run.setText(mainTitle);
    }
}
